/*
 * @(#)DataCache.java Jun 24, 2008
 * 
 * Copyright 2007 by ChinanetCenter Corporation.
 *
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * ChinanetCenter Corporation ("Confidential Information").  You
 * shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement
 * you entered into with ChinanetCenter.
 * 
 */
package com.cnc.bas.util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.cnc.ssm.ISsmService;


/**
 * 
 * @author LW
 * @date   Apr 9, 2009
 * @version 1.0
 */

public class DataCache {
	
	private static Map<String,List> menuCache = new HashMap<String,List>();
	
	private static ISsmService ssmService = (ISsmService)SpringBeanFactory.getBean(Constants.BEAN_NAME_SSM);
	
	
	
	/**
	 * 从缓存中获取菜单信息
	 * @param userCode
	 * @param i18
	 */
	public static List getMenuList(String userCode, String i18){
		
		String key = userCode + i18;
		
		List menuList = menuCache.get(key);
		
		if(menuList == null){
			
			menuList = ssmService.listUserMenu(userCode, i18);
			
			menuCache.put(key, menuList);
		}	
			
			
		return menuList;
		
	}
	
	/**
	 * 清空菜单缓存
	 */
	public static void clearMenuCache(){		
			menuCache.clear();	
	}	
	

}


